package de.baumann.browser.activitys

import android.content.Context
import android.content.Intent
import de.baumann.browser.R
import de.baumann.browser.activitys.user.UserInfoActivity
import de.baumann.browser.api.net.base.OdinUtil
import de.baumann.browser.base.BaseOdinActivity
import de.baumann.browser.base.BasePresenter
import de.baumann.browser.iview.IBaseView
import de.baumann.browser.utils.Constants
import de.baumann.browser.utils.isLogined
import kotlinx.android.synthetic.main.activity_setting.*
import kotlinx.android.synthetic.main.include_tool_bar.*

/**
 *@author:
 *@date:2019/7/1 17:01
 *@discription: 设置页面
 */
class SettingActivity : BaseOdinActivity<IBaseView, BasePresenter<IBaseView>>() {

    override fun createPresenter(): BasePresenter<IBaseView>? {
        return null
    }

    override fun createView(): IBaseView? {
        return null
    }

    companion object {
        fun startSettingActivity(context: Context) {
            context.startActivity(Intent(context, SettingActivity::class.java))
        }
    }


    override fun getLayout(): Int {
        return R.layout.activity_setting
    }

    override fun initView() {
        initToolbar(commToolBar, commTitle)
        tvVersionName.text = String.format(getString(R.string.current_version, OdinUtil.getAppVersionName(mContext)))
        //个人信息
//        rlUserInfoSetting.setOnClickListener {
//            if (isLogined()){
//                UserInfoActivity.startUserInfoSettingActivity(mContext)
//            }else{
//                showLoginDialog()
//            }
//        }

        //搜索引擎
        rlSearchEngine.setOnClickListener {
            EngineActivity.startEngineActivity(mContext)
        }

        //意见反馈
        rlFeedback.setOnClickListener {
            if (isLogined()) {
                FeedBackActivity.startFeedBackActivity(mContext)
            } else {
//                showLoginDialog()
            }
        }

        //关于ODIN
        rlAboutOdin.setOnClickListener {
            H5Activity.startAboutOdinActivity(mContext, Constants.ABOUT_ODIN_URL)
        }
    }

    override fun initData() {

    }

    override fun getTitleText(): String {
        return getString(R.string.setting_label)
    }
}
